package com.mall.mapper;

import com.github.pagehelper.Page;
import com.mall.dto.GoodsPageQueryDTO;
import com.mall.po.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.vo.GoodsPageQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author itlxc
 * @since 2024-04-18
 */
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {

    /**
     * 根据商品id查询该商品所属品牌的状态
     * @param id
     */
    Integer getBrandsStatusById(Long id);

    /**
     * 商品分页查询
     * @param goodsPageQueryDTO
     * @return
     */
    Page<GoodsPageQueryVO> pageQuery(GoodsPageQueryDTO goodsPageQueryDTO);

    /**
     * 根据品牌状态查询品牌数量
     * @param enable
     * @return
     */
    @Select("select count(*) from goods where status = #{status}")
    Integer countBrand(Integer enable);
}
